﻿@{
    Layout = null;
}
@model ElingOA6_Admin_DSJCJ.Model.ChkInfoCls
<!DOCTYPE html>

<html>
@Html.Partial("LoadPanelPartial")
<head>
    <title>GroupEdit</title>
        @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/PageCommon.js", true)" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>
      <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <script type="text/javascript">

        $(function () {
            $('input[name=FStdScore]').keydown(function () {
                var k = window.event.keyCode;

                if ((k == 161) || (k == 46) || (k == 8) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40)) {
                    if (k == 110 || k == 190) {

                        if ($(this).val().length == 0 || $(this).val().indexOf(".") != -1) {

                            window.event.returnValue = false;
                        }
                    }
                    if (k == 161) {
                        window.event.keyCode = 64;
                    }

                }
                else if (k == 13) {
                    window.event.keyCode = 9;
                }
                else {
                    window.event.returnValue = false;
                }
            });

        });

        //
        function change(s, e) {
            var val = ASPxClientRadioButtonList.Cast("FChkType");
            if (val.GetValue() == "1") {
                ASPxClientTextBox.Cast("FStdScore").SetEnabled(true);
            } else if (val.GetValue() == "2") {
                ASPxClientTextBox.Cast("FStdScore").SetValue("0");
                ASPxClientTextBox.Cast("FStdScore").SetEnabled(false);

            }
        }

        //
        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnSave":
                    {
                        //保存
                        var infoClsName = FInfoClsName.GetText();
                        var stdScore = FStdScore.GetText();
                        if ($.trim(infoClsName) == "") {
                            alert("请填写栏目名称！");
                            return false;
                        }
                        if ($.trim(stdScore) == "") {
                            alert("请填写每篇基分！");
                            return false;
                        }

                        form1.submit();
                        break;
                    }
                case "btnAddSame":
                    {
                        //增同级
                        window.location.href = rootPath + "/Admin/ChkInfoCls/ChkInfoClsAdd?year=" + $("#hidyear").val() + "&preid=" + $("#hidPreInfoClsNo").val();
                        break;
                    }
                case "btnAddNext":
                    {
                        //增下级

                        window.location.href = rootPath + "/Admin/ChkInfoCls/ChkInfoClsAdd?year=" + $("#hidyear").val() + "&preid=" + $("#hidInfoClsNo").val();
                        break;
                    }
                case "btnDelete":
                    {
                        //删除
                        var fInfoClsNo = $("#hidInfoClsNo").val();
                        if (confirm("确定删除?")) {
                            $.ajax({
                                type: 'POST',
                                url: rootPath + '/Admin/ChkInfoCls/DelChkInfoCls',
                                data: { fInfoClsNo: fInfoClsNo , year: $("#hidyear").val() },
                                success: function (result) {
                                    if (result == "ok") {
                                        alert("删除成功");
                                        window.parent.location.href = rootPath + "/Admin/ChkInfoCls";
                                    }
                                    else if (result == "existsentry") {
                                        alert("数据被引用，删除失败");
                                    }
                                    else if (result == "existsbll") {
                                        alert("数据被引用，删除失败！");
                                    } else {
                                        alert("删除失败!");
                                    }
                                }
                            });

                        }

                    }
            }
        }


    </script>
    
    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)
</head>
<body>
@using (Html.BeginForm("Update", "ChkInfoCls", FormMethod.Post, new { id = "form1" }))
{ 
        <div class="floatToolMenu" id="toolMenu">
            @Html.DevExpress().Menu(settings =>
       {
           settings.Name = "toolBarMenu";
           settings.ItemAutoWidth = false;
           settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
           settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
           settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
           settings.Items.Add(item =>
           {
               item.Name = "btnSave";
               item.Text = "保存";
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");

           });
           settings.Items.Add(item =>
           {
               item.Name = "btnAddSame";
               item.Text = "增加同级";
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/addSame.png");

           });
           settings.Items.Add(item =>
           {
               item.Name = "btnAddNext";
               item.Text = "增加下级";
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/addNext.png");

           });
           settings.Items.Add(item =>
           {
               item.Name = "btnDelete";
               item.Text = "删除";
               item.ItemStyle.ForeColor = System.Drawing.Color.Red;
               item.ClientEnabled = true;
               item.Image.Url = Url.Content("~/Content/ControlImages/cancel.png");

           });
           settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
           settings.ItemLinkMode = ItemLinkMode.ContentBounds;
       }).GetHtml()
        </div>
    <table class="tableFrom" align="center">
            <tr>
                <th style="text-align: right;"width="15%">
                    栏目编号:</th>
                <td style="text-align: left;" width="85%">
                 @Html.DevExpress().Label(settings => 
                   {
                       settings.Name = "FInfoClsNo";
                       settings.Text = Model.FInfoClsNo; 
                        
                   }).GetHtml()
                       @Html.Hidden("hidInfoClsNo", Model.FInfoClsNo)   
                </td>
            </tr>
            <tr>
                <th style="text-align: right;">
                    上级栏目编号:</th>
                <td style="text-align: left;">
                    @Html.DevExpress().Label(settings => 
                   {
                       settings.Name = "FPreInfoClsNo";
                       settings.Text = Model.FPreInfoClsNo; 
                        
                   }).GetHtml()
                   @Html.Hidden("hidPreInfoClsNo",Model.FPreInfoClsNo)
                </td>
            </tr>
            <tr>
                <th style="text-align: right;">
                    栏目名称:</th>
                <td style="text-align: left;">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FInfoClsName";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FInfoClsName;
                   settings.Enabled = true; ;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()    
                </td>
            </tr>
            <tr>
                <th style="text-align: right;">
                    计分方式:</th>
                <td style="text-align: left;">
                 @Html.DevExpress().RadioButtonList(settings =>
                    {
                        settings.Name = "FChkType";
                        settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
                        settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                        settings.Properties.ClientSideEvents.SelectedIndexChanged = "function(s, e){ change(s ,e)}";
                        settings.Properties.RepeatColumns = 2;
                    }).BindList(new List<SelectListItem> { 
                            new SelectListItem { Text = "篇数", Value = "1"}, 
                            new SelectListItem { Text = "分数", Value = "2" } 
                    }).Bind(Model.FChkType).GetHtml()
                </td>
            </tr>
            <tr>
                <th style="text-align: right;">
                    每篇基分:</th>
                <td style="text-align: left;">
                     @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FStdScore";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FStdScore.ToString();
                   settings.Enabled = true; ;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml() 
                </td>
            </tr>
           <tr>
            <th style="text-align: right;">
                    是否需要考核:</th>
                <td style="text-align: left;">
                @Html.DevExpress().RadioButtonList(settings =>
                    {
                        settings.Name = "FisExamine";
                        settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
                        settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                        settings.Properties.RepeatColumns = 2;
                    }).BindList(new List<SelectListItem> { 
                            new SelectListItem { Text = "是", Value = "Y"}, 
                            new SelectListItem { Text = "否", Value = "N" } 
                    }).Bind(Model.FisExamine).GetHtml()
                </td>
            </tr>
    
    </table>
    @Html.Hidden("hidyear",ViewData["year"])
}
</body>
</html>
